//
//  DiscoveryMenuView.m
//  Car
//
//  Created by 何晓文 on 15/9/25.
//  Copyright © 2015年 朱鸿儒. All rights reserved.
//

#import "DiscoveryMenuView.h"


@implementation DiscoveryMenuView

- (instancetype)initWithFrame:(CGRect)frame {
	int kButtonW = 100;
	int distance = 40;
	if (kHeight == 480)   {
		kButtonW = 75;
		distance = 60;
	}else if (kHeight <= 667) {
		kButtonW = 130;	
	
	}
	if (self = [super initWithFrame:frame]) {
		//模特
		self.modelButton = [UIButton buttonWithType:(UIButtonTypeCustom)];
		
		self.modelButton.frame = CGRectMake((kWidth - (kButtonW * 2 + 20 + distance)) / 2, 20, kButtonW, kButtonW);
		
		[self.modelButton setImage:[UIImage imageNamed:@"modelicon"] forState:(UIControlStateNormal)];
		[self setUpButton:self.modelButton];
		[self addSubview:self.modelButton];
		
		UILabel *modelLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.modelButton.x, self.modelButton.y + kButtonW + 5, kButtonW, 20)];
		modelLabel.textColor = [UIColor goldenrodColor];
		modelLabel.text = @"媳妇模特";
		modelLabel.textAlignment = NSTextAlignmentCenter;
		modelLabel.font = [UIFont systemFontOfSize:14];
		[self addSubview:modelLabel];
		//地图
		self.mapButton = [UIButton buttonWithType:(UIButtonTypeCustom)];
		
		self.mapButton.frame = CGRectMake(self.modelButton.x + kButtonW + 20 + distance, self.modelButton.y,kButtonW, kButtonW);
		
		[self.mapButton setImage:[UIImage imageNamed:@"mapicon"] forState:(UIControlStateNormal)];
		[self setUpButton:self.mapButton];
		[self addSubview:self.mapButton];
		UILabel *mapLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.mapButton.x, self.mapButton.y + kButtonW + 5, kButtonW, 20)];
		mapLabel.textColor = [UIColor goldenrodColor];
		mapLabel.text = @"地图导航";
		mapLabel.textAlignment = NSTextAlignmentCenter;
		mapLabel.font = [UIFont systemFontOfSize:14];
		[self addSubview:mapLabel];
		//违章查询
		self.moreButton = [UIButton buttonWithType:(UIButtonTypeCustom)];
		
		self.moreButton.frame = CGRectMake(self.modelButton.x, self.modelButton.y + kButtonW + 40,kButtonW, kButtonW);
		
		[self.moreButton setImage:[UIImage imageNamed:@"illicon"] forState:(UIControlStateNormal)];
		[self setUpButton:self.moreButton];
		[self addSubview:self.moreButton];
		
		UILabel *otherLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.moreButton.x, self.moreButton.y + kButtonW + 5, kButtonW, 20)];
		otherLabel.textColor = [UIColor goldenrodColor];
		otherLabel.text = @"违章查询";
		otherLabel.textAlignment = NSTextAlignmentCenter;
		otherLabel.font = [UIFont systemFontOfSize:14];
		[self addSubview:otherLabel];
		//活动
		self.ActButton = [UIButton buttonWithType:(UIButtonTypeCustom)];
		
		self.ActButton.frame = CGRectMake(self.modelButton.x + kButtonW + 20 + distance,self.modelButton.y + kButtonW + 40 , kButtonW, kButtonW);
		
		[self.ActButton setImage:[UIImage imageNamed:@"calicon"] forState:(UIControlStateNormal)];
		[self setUpButton:self.ActButton];
		[self addSubview:self.ActButton];
		
		UILabel *actLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.ActButton.x, self.ActButton.y + kButtonW + 5, kButtonW, 20)];
		actLabel.textColor = [UIColor goldenrodColor];
		actLabel.text = @"购车计算";
		actLabel.textAlignment = NSTextAlignmentCenter;
		actLabel.font = [UIFont systemFontOfSize:14];
		[self addSubview:actLabel];
	
		
	}
	return self;

}
- (void)setUpButton:(UIButton *)button {
	button.layer.borderColor = [UIColor whiteColor].CGColor;
	button.layer.borderWidth = 4;

	button.layer.cornerRadius = button.bounds.size.height / 2;
	button.layer.shadowColor = [UIColor blackColor].CGColor;
	button.layer.shadowOffset = CGSizeMake(2, 2);
	button.layer.shadowOpacity = 0.8;

}
@end
